/* 
 * File:   EntityParticleComponent.cpp
 * Author: RedEyedKiller
 * 
 * Created on 17 Οκτώβριος 2010, 1:20 μμ
 */

#include "ParticleComponent.h"
#include "../physics/ParticleSystemManager.h"
#include "../Entity.h"
#include "../physics/PhysicsManager.h"

namespace EntitySystem
{

namespace components
{

ParticleComponent::ParticleComponent(const std::string& sys,const Math::Vector2F& relPosit):system(sys),relPosition(relPosit)
{
    emiterId = -1;
}

ParticleComponent::ParticleComponent(const ParticleComponent& orig):system(orig.system),relPosition(orig.relPosition)
{
    emiterId = -1;
}

ParticleComponent::~ParticleComponent()
{
    if(emiterId != -1)
    {
        //FIXME Andy
        //physicsSystem::particleSystem::ParticleSystem* sys = physicsSystem::PhysicsManager::GetInstance()->GetParticleSystem(system);
        //sys->KillEmiter(emiterId);
        emiterId = -1;
    }
}

ParticleComponent* ParticleComponent::Clone()
{
    return new ParticleComponent(*this);
}

bool ParticleComponent::RegisterEmiter()
{

    //emiterId = sys->AddPrototypedEmiterAt(relPosition + parent->GetPosition());
    return true;
}

}

}
